Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check all dependency jars before marking unused #967

Merged
merged 6 commits into from
May 12, 2023

Conversation

mauriciogg
Copy link
Contributor

@mauriciogg mauriciogg commented May 10, 2023

A dependency might produce more than one jar (e.g. android targets produce a library jar and a resources jar). If one of those jars is unused, the current logic will mark the dependency as unused. This change only marks the dependency unused if none of the jars are used.

  • Also ran ktlint

A dependency might produce more than one jar (e.g. android targets produce a library jar and a resources jar).
If one of those jars is unused, the current logic will mark the dependency as unused. 
This change only marks the dependency unused if none of the jars are used.
@Bencodes
Copy link
Collaborator

@mauriciogg can you fix the KtLint issues?

val unusedLabels = dependencyMap.values
.filter { it.kind == Deps.Dependency.Kind.UNUSED }
.mapNotNull { readJarOwnerFromManifest(Paths.get(it.path)).label }
val kindMap = mutableMapOf<String, Deps.Dependency.Kind>()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mauriciogg is there any test coverage for this behavior in JdepsMergerTest that can be added?

Mauricio Galindo added 2 commits May 11, 2023 13:46
@Bencodes Bencodes merged commit 53c490a into bazelbuild:master May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants